/**
 * 
 */
package com.e5.training.dao;

import java.sql.SQLException;
import java.util.List;

import org.springframework.dao.DataAccessException;

/**
 * @author felix
 * 
 * 
 */
public interface UserDao<User> {
	

/**
 * get user from database according to id
 * @param id
 * @return
 * @throws DataAccessException
 */
	public User getUser(Integer id)throws DataAccessException;
	/**
	 * get user from database according to userid
	 * @param id
	 * @return
	 * @throws DataAccessException
	 */
		public User getUserByUserid(String userid)throws DataAccessException;
	/**
	 * new a new user
	 * 
	 * @param user
	 * @return if insert success return true
	 * @throws SQLException
	 */
	public boolean addUser(User user) throws DataAccessException;

	/**
	 * edit a user's information take attention to primary key
	 * 
	 * @param user
	 * @return
	 * @throws SQLException
	 */
	public boolean editUser(User user) throws DataAccessException;

	/**
	 * delete from database
	 * 
	 * @param userid
	 * @return
	 * @throws SQLException
	 */
	public boolean delUser(Integer id) throws DataAccessException;

	/**
	 * validate the user's password 
	 * @param userid
	 * @param password
	 * @return session
	 * @throws SQLException
	 */
	public User isValidUser(String userid, String password) throws DataAccessException;

	/**
	 * get all User's information in database
	 * 
	 * @return the list
	 * @throws SQLException
	 */
	public List<User> listAllUser() throws DataAccessException;

	/**
	 * get a list of user's information Pagination
	 * 
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 * @throws SQLException
	 */
	public List<User> listOfUserPage(Integer pageIndex, Integer pageSize)
			throws DataAccessException;

}
